package com.zw._03_fanout_2;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.zw.ConnectionUtil;

public class Send {
    public static final String MQ_EXCHANGE = "mq_exchange";
    public static void main(String[] args) throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(MQ_EXCHANGE, BuiltinExchangeType.FANOUT);
        channel.basicPublish(MQ_EXCHANGE, "", null, "这次一定行".getBytes());
        System.out.println("成功发送消息");
    }
}
